package com.woniuxy.controller;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.woniuxy.entity.RbacRole;
import com.woniuxy.entity.ResponseEntity;
import com.woniuxy.service.RbacRoleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @Author: 马宇航
 * @Do: 处理角色列表查询的controller
 * @DateTime: 22/05/25/0025 下午 3:14
 * @Component: 成都蜗牛学苑
 **/
@RestController
@RequestMapping("/rbacRole")
public class RbacRoleController {
    @Autowired
    RbacRoleService rbacRoleService;
    @GetMapping("/role/{current}/{size}")
    public ResponseEntity findAll(@PathVariable("current") int currentPage,@PathVariable("size") int pageSize){
        PageHelper.startPage(currentPage,pageSize);
        List<RbacRole> all =rbacRoleService.findAll();
        PageInfo<RbacRole> rbacRolePageInfo = new PageInfo<>(all);
        return  new ResponseEntity(rbacRolePageInfo);
    }
}
